<template>
    <div>
      <el-row :gutter="10">
        <el-col :span="4">
          <el-tabs v-model="activeName" style="background-color: white" type="card">
            <el-tab-pane label="组织机构" name="zzjg" >
              <el-row style="position: relative">
                <el-col :span="25" style="overflow: auto;width: 100%;" :style="{height:heightTree}">
                  <el-tree
                    :props="props"
                    :load="loadNode"
                    lazy
                    @node-click="itemClick"
                    :expand-on-click-node="false"
                    :highlight-current="true"
                    style="min-width: 100%;display: inline-block;background-color: transparent"
                  >
            <span slot-scope="{ node, data }">
              <span>
                  <i v-bind:class="data.icon"></i>{{ node.label }}
              </span>
            </span>
                  </el-tree>
  
                </el-col>
              </el-row>
              <el-checkbox v-model="isContain" style="margin: 10px 0px 10px 20px">包含下级</el-checkbox>
            </el-tab-pane>
          </el-tabs>
        </el-col>
        <el-col :span="20">
  
          <div style="padding:10px 10px;background-color: white">
                      <el-select v-model="selectHis" placeholder="请选择" style="margin-bottom: 10px">
                        <el-option
                          v-for="item in a0163s"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"
                        />
                      </el-select>
  
            <!--<el-select v-model="searchType" placeholder="请选择" style="margin-bottom: 10px">
              <el-option
                v-for="item in selectWay"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>-->
            <el-input
              v-model="searchName"
              placeholder="请输入姓名或身份证号"
              style="width: 200px"
              @input="filter($event)"
            />
  
            <el-button type="primary" plain icon="el-icon-search" @click="query">查询</el-button>
            <el-button type="primary" plain icon="el-icon-search" @click="showSearchs">精确查询</el-button>
  <!--          <el-button v-if="boolea == 'true'" type="primary" plain icon="el-icon-coordinate" @click="updatePersonType">人员关系变更</el-button>-->
            <br/>
            <el-button type="primary" plain icon="el-icon-s-marketing" @click="wareHousingOpen">入库</el-button>
            <el-button type="primary" plain icon="el-icon-s-release" @click="personOut" v-if="boolea == 'true'">出库</el-button>
            <el-button type="primary" plain icon="el-icon-star-on" @click="collect">收藏</el-button>
  
            <el-button type="primary" plain icon="el-icon-document-copy" @click="updatePersonList">批量维护</el-button>
  
            <el-button type="primary" plain icon="el-icon-edit" @click="updatePersonInfo">xlsx导出字段</el-button>
            <el-button type="primary" plain icon="el-icon-download" @click="downloadPersonList">导出列表</el-button>
  
              <el-button type="primary" plain icon="el-icon-document-delete" @click="openPerson">变动记录</el-button>
          </div>
          <vxe-table
            element-loading-text="数据加载中"
            v-loading="loading"
            ref="mytable"
            :height="heightY"
            :data="articlesData"
            style="width: 100%;margin-top: 10px"
            :row-config="{ useKey: true, keyField: 'getRowKeys' }"
            border
            highlight-current-row
            @current-change="selectChange"
            @checkbox-change="handleSelectionChange"
            @checkbox-all="handleAllSelectChang"
            @cell-dblclick="dbSelected"
            show-overflow
          >
            <vxe-column
              type="checkbox"
              :reserve-selection="true"
              width="40"
              fixed="left"
            />
  
  
            <vxe-column
              field="a0101"
              title="姓名"
              width="100"
              sortable
              align="center"
              fixed="left"
            >
              <template slot-scope="scope">
                <div @click="dbSelected(scope.row)"  style="color:#0220bf;cursor:pointer;">{{ scope.row.a0101 }}</div>
              </template>
            </vxe-column>
  
            <vxe-column
              field="a0184"
              title="身份证号"
              width="180"
              align="center"
              fixed="left"
            />
            <vxe-column
              field="a0104"
              title="性别"
              width="50"
            />
            <vxe-column
              field="a0117"
              title="民族"
              width="80"
            />
            <vxe-column
              field="a0192a"
              title="工作单位及职务"
              width="250"
              show-overflow="tooltip"
            >
            </vxe-column>
  
  
            <vxe-column
              field="a0107"
              title="出生年月"
              width="100"
              :formatter="formatDate"
            />
  
            <vxe-column
              field="a0111a"
              title="籍贯"
              width="115"
            />
            <vxe-column
              field="a0114a"
              title="出生地"
              width="100"
            />
            <vxe-column
              field="a0134"
              title="参加工作时间"
              width="120"
              :formatter="formatDate"
            />
            <vxe-column
              field="a0140"
              title="入党时间"
              width="120"
            />
            <vxe-column
              field="qrzxl"
              title="最高全日制学历"
              width="120"
            />
            <vxe-column
              field="qrzxlxx"
              title="院校系专业"
              width="180"
              show-overflow="tooltip"
            />
            <vxe-column
              field="qrzxw"
              title="最高全日制学位"
              width="120"
            />
            <vxe-column
              field="qrzxwxx"
              title="院校系专业"
              width="180"
              show-overflow="tooltip"
            />
            <vxe-column
              field="zzxl"
              title="最高在职学历"
              width="120"
            />
            <vxe-column
              field="zzxwxx"
              title="院校系专业"
              width="180"
              show-overflow="tooltip"
            />
            <vxe-column
              field="zzxw"
              title="最高在职学位"
              width="120"
            />
            <vxe-column
              field="zzxlxx"
              title="院校系专业"
              width="180"
              show-overflow="tooltip"
            />
            <vxe-column
              field="a0192f"
              title="工作单位及职务任职时间"
              width="180"
            />
            <vxe-column
              field="a0221"
              title="现职务层次"
              width="120"
            />
            <vxe-column
              field="a0288"
              title="任现职务层次时间"
              width="160"
            />
            <vxe-column
              field="a0192e"
              title="现职级"
              width="250"
              show-overflow="tooltip"
            >
            </vxe-column>
            <vxe-column
              field="a0191"
              title="任现职时间"
              width="110"
            />
            <vxe-column
              field="a0120"
              title="级别"
              width="120"
            />
            <vxe-column
              field="a0196"
              title="专业技术职务"
              width="130"
            />
            <vxe-column
              field="a0122"
              title="专业技术类公务员任职资格"
              width="200"
            />
            <vxe-column
              field="a0187a"
              title="专长"
              width="100"
              show-overflow="tooltip"
            />
            <vxe-column
              field="a0165"
              title="管理类别"
              width="120"
            />
            <vxe-column
              field="a0160"
              title="人员类别"
              width="120"
            />
            <vxe-column
              field="a0121"
              title="编制类型"
              width="100"
            />
            <vxe-column
              field="a2949"
              title="公务员登记时间"
              width="130"
            />
            <vxe-column
              field="a0197"
              title="是否两年以上基层工作经历"
              width="200"
            />
            <vxe-column
              field="a0128"
              title="健康状况"
              width="80"
            />
            <vxe-column
              field="a0163"
              title="人员管理状态"
              width="110"
            />
            <!--        <vxe-column
                      field="zgxl"
                      title="最高学历"
                      width="120"
                    />
                    <vxe-column
                      field="zgxlxx"
                      title="最高学历学校"
                      width="160"
                      show-overflow="tooltip"
                    />
                    <vxe-column
                      field="zgxw"
                      title="最高学位"
                      width="120"
                    />
                    <vxe-column
                      field="zgxwxx"
                      title="最高学位学校"
                      width="160"
                      show-overflow="tooltip"
                    />-->
            <vxe-column
              field="a0195"
              title="统计关系所在单位"
              width="160"
              show-overflow="tooltip"
            />
  
          </vxe-table>
          <div class="row" style="background: #fff;">
            <div class="col-sm text-sm-left text-left3 pt-3" >
              <vxe-pager
                background
                align="left"
                :current-page.sync="currentPage"
                :page-size.sync="perPage"
                :total="totalItems"
                :layouts="['PrevJump', 'PrevPage', 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
                @page-change="handleSizeChange">
              </vxe-pager>
              <!--          <el-pagination-->
              <!--            background-->
              <!--            :current-page="currentPage"-->
              <!--            :page-sizes="[10,20, 30, 40, 50]"-->
              <!--            :page-size="perPage"-->
              <!--            layout="total, sizes, prev, pager, next, jumper"-->
              <!--            :total="totalItems"-->
              <!--            @size-change="handleSizeChange"-->
              <!--            @current-change="onchangecurrentPage"-->
              <!--          />-->
            </div>
            <div>
              <rmb-add v-if="showRMB" ref="rmb" @addCallback="initData"/>
              <person-out v-if="showPersonOut" ref="personOut" @personout="initData"/>
            </div>
          </div>
        </el-col>
      </el-row>
  
      <div>
        <rmb-add v-if="showRMB" ref="rmb" @addCallback="initData"/>
      </div>
      <div>
        <search v-if="showSearch" ref="search" @reloadList="initData"/>
      </div>
      <div>
        <updatePersons v-if="showUpdatePerson" ref="updatePersons" @indexInitAdd="initData"/>
      </div>
      <div>
        <show-basicZwShow v-if="showBasicZwShow" ref="dialogBasicZw" @reloadZwlb="initItemZwlb"/>
      </div>
      <div>
        <updatePersonInfoExexl v-if="showUpdatePersonInfoExexl" ref="updatePersonInfoExexl" @indexInitAdd="initData"/>
        <update-person-type-change v-if="showUpdatePersonType" ref="updatePersonTypeChange" @personout="initData"/>
      </div>
      <div>
        <wareHousing v-if="showWareHousing" ref="wareHousing"></wareHousing>
  
      </div>
      <div>
        <personRemind v-if="dialogVisiblePerson" ref="personRem" @refreshCallback="closePersonRem"></personRemind>
      </div>
    </div>
  </template>
  <script>
      import userSearch from '@/views/young/system/userDepartment/userSearch'
      import wareHousing from '@/views/young/datacollect/wareHousing'
      import {personCHoose, getB01ByParentId,exportExeclForPersonList} from '@/api/young/datacenter/person.js'
      import rmb from '@/views/young/datacollect/rmbInfo/rmb'
      import search from '@/views/young/datacollect/search'
      import {getA36ByA0000, collectData} from '@/api/young/datacollect/rmbInfo/rmb'
      import personOut from '@/views/young/datacollect/rmbInfo/personOut'
      import updatePersons from '@/views/young/system/collect/updatePersonList'
      import store from '@/store'
      import basicZwShow from '@/views/young/datacollect/cadrePortrayal/basicZw'
  
      import {getItem} from '@/api/young/system/role/role'
      import personRemind from '@/views/young/datacollect/rmbInfo/personRemind'
      import updatePersonInfoExexl from '@/views/young/system/collect/updatePersonInfoExcel'
      import updatePersonTypeChange from '@/views/young/datacollect/rmbInfo/updatePersonType'
      import {
          getPersonsCount,getUserType
      } from '@/api/young/datacollect/rmbInfo/rmb'
  
  
      export default {
          name: 'PersonList',
          metaInfo: {
              title: '人员部门'
          },
          components: {
              'personRemind':personRemind,
  
              // eslint-disable-next-line vue/no-unused-components
              'user-search': userSearch,
              // eslint-disable-next-line vue/no-unused-components,no-undef
              'rmb-add': rmb,
              'person-out': personOut,
              'search': search,
              'updatePersons': updatePersons,
              'show-basicZwShow': basicZwShow,
              'wareHousing': wareHousing,
              'updatePersonInfoExexl': updatePersonInfoExexl,
              'update-person-type-change': updatePersonTypeChange,
          },
          data: () => ({
              selectHis:'1',
              personCount:0,
              showUpdatePersonInfoExexl: false,
              dialogVisiblePerson:false,
              props: {
                  label: 'name',
                  children: 'zones',
                  isLeaf: 'leaf',
                  icon: ''
              },
              showUpdatePersonType: false,
              loading:false,
              icon: '',
              itemList: [], // 权限字段
              showWareHousing: false,
              showBasicZwShow: false,
              showUpdatePerson: false,
              isContain: true,
              valid: '',
              showUserSearch: true,
              a0163: '1',
              personList: [],
              multipleSelection:[],
              isCheck: false,
              A0184: '',
              showPersonOut: false,
              A0101: '',
              current: '',
              searchName: '',
              showRMB: false,
              showSearch: false,
              a0165: '',
              AS0119: '3',
              radioC: '1',
              // searchType: '1',
              AS0101: '',  // 女干部
              AS0103: '', // 少数民族干部
              AS0104: '', // 党外干部
              a0163s: [{
                  value: '1',
                  label: '优秀少数民族干部'
              }, {
                  value: '2',
                  label: '历史优秀少数民族干部'
              }
              // , {
              //     value: '2',
              //     label: '女干部'
              // }, {
              //     value: '3',
              //     label: '少数民族干部'
              // }, {
              //     value: '4',
              //     label: '党外干部'
              // }
              ],
              a0165s: [{
                  value: '',
                  label: '增加人员'
              }, {
                  value: '01',
                  label: '导入任免表'
              }, {
                  value: '02',
                  label: '批量导入任免表'
              }, {
                  value: '03',
                  label: '手工录入人员信息'
              }],
  
              /*  radioCs: [{
                    value: '1',
                    label: '全库查询'
                }, {
                    value: '2',
                    label: '二次查询'
                }, {
                    value: '3',
                    label: '追加查询'
                }, {
                    value: '4',
                    label: '剔除查询'
                }],*/
              /*selectWay: [{
                  value: '1',
                  label: '姓名查询'
              }, {
                  value: '2',
                  label: '身份证查询'
              }],*/
              selectedPerson: [],
              // 分页
              searchKeys: ['getintoId', 'roleName'],
              totalItems: 0,
              currentPage: 1,
              perPage: 20,
              articlesData: [],
              // 选中的树节点
              selectedNode: '',
              defaultProps: {
                  id: 'id',
                  children: 'children',
                  label: 'text'
              },
              // 家庭成员信息（表单提交保存用）
              a36s: [{
                  // 称谓
                  relation: '',
                  // 称谓描述
                  relationdesc: '',
                  // 姓名
                  name: '',
                  // 出生日期
                  birthDate: '',
                  // 政治面貌
                  policitalStatus: '',
                  // 政治面貌描述
                  policitalStatusdesc: '',
                  // 工作单位及职务
                  jobPost: ''
              }],
              heightTree: window.innerHeight - 220 + 'px',
              heightY: window.innerHeight - 275 + 'px',
              activeName:'zzjg',
              boolea: '',
              queryParams: [] // 接收精确查询的条件
          }),
          computed: {},
          mounted() {
              this.initAdd()
          },
          methods: {
              closePersonRem(){
                  this.initAdd();
                  this.query();
              },
              openPerson() {
                  this.dialogVisiblePerson=true;
                  this.$nextTick(()=>{
                      this.$refs.personRem.getPersonsInit(500,'AS0103','nation');
                  })
              },
              loadNode(node, resolve) {
                  let params
                  if (node.level === 0) {
                      // 获得parentId = -1 的树
                      params = {
                          'userId': store.getters.user_id.toString(),
                          'parentId': '-1'
                      }
                  } else {
                      params = {
                          'userId': store.getters.user_id.toString(),
                          'parentId': node.data.id
                      }
                  }
                  getB01ByParentId(params).then((data) => {
                      // console.info(data.resultdata)
                      //return resolve(data.resultdata);
                      data.resultdata.forEach((item) => {
                          //let treeIcon = ''
                          if (item.b0194 == '3') {
                              item.icon = 'customRoot-icon'
                          } else if (item.b0194 == '2') {
                              item.icon = 'customChildren-icon'
                          } else if (item.b0194 == '1') {
                              item.icon = 'customParent-icon'
                          }
                          // = treeIcon
                      })
                      return resolve(data.resultdata)
                  })
  
                  //if (node.level > 1) return resolve([]);
  
              },
              // 根据roleId 获取权限字段
              getJurisdictionItem() {
                  const that = this
                  // eslint-disable-next-line no-undef
                  getItem().then(function (result) {
                      that.itemList = []
                      // console.info(result.resultdata, '权限字段')
                      if (result.result) {
                          that.itemList = result.resultdata // 权限字段
  
                      }
                  })
              },
              // async initItemZwlb(params) {
              //   console.log(params,6)
              //   this.person.AG0136 = params.ag0201
              //   this.person.AG0136A = params.ag0201a
              // },
              async  initAdd() {
                  var that = this
                  // 当前登录人是否为超级管理员
                  getUserType().then(function (result) {
  
                      console.info(result,"resultdata")
                      that.boolea = result.resultdata[0]
                  })
                  let params={
                      'column':'AS0103',
                      'type':'nation'
                  }
                  // let resultD = await getPersonsCount(params)
                  // if (resultD.result) {
                  //     that.personCount = resultD.resultdata;
                  // }
                  /* this.articlesData = null
                   const that = this
                   // eslint-disable-next-line no-unused-vars
                   const dataChange = []
                   const personJsons = {
                       'userId': store.getters.user_id.toString()
                   }
                   personCHoose('/system/user/queryChildNodeTree', personJsons).then((temporary) => {
                       //      const temporary = JSON.parse(res)// 将字符串转换成json对象
  
                       if (temporary.result) {
                           // eslint-disable-next-line no-const-assign
  
                           if (temporary.resultdata) {
                               that.treeData = that.getParent('-1', temporary.resultdata)
                           }
                           // this.treeData = this.getParent('-1', temporary.resultdata)
                       } else {
                           this.$message.error(temporary.message)
                       }
                   })*/
                  that.visible = true
              },
              selectChange(currentRow) {
                  this.current = currentRow
              },
  
  
              getnodeico(data) {
                  if (data.id === '1') {
                      return 'el-icon-folder'
                  } else {
                      return 'el-icon-folder'
                  }
              },
              handleSelectionChange(personRow) {
                  this.personList = []
                  this.multipleSelection = []
                  this.personList = personRow.records
              },
              handleAllSelectChang({ checked, records }){
                this.personList = []
                this.multipleSelection = []
                this.multipleSelection = records
              },
              wareHousingOpen() {//入库
                  var that = this;
                  that.showWareHousing = true;
                  that.$nextTick(() => {
                      that.$refs.wareHousing.init('nation')
                  })
              },
              personOut() { // 出库
                  var that = this
                  let dataList = this.personList.length || this.multipleSelection.length
                  if (dataList == 0) {
                      that.$message({
                          message: '请选择人员',
                          type: 'warning'
                      })
                      return
                  }
                  let listpersonlist=[...this.personList,...this.multipleSelection]
                  listpersonlist.forEach((item) => {
                      if (item.AS0119 == '0') {
                          that.$message({
                              message: '选择中包含有已出库人员',
                              type: 'warning'
                          })
                          return
                      }
                  })
                  // 点击出库的时候 将勾选的人员进行判断 （女少非人员是没有出库的）
                  that.showPersonOut = true
                  that.$nextTick(() => {
                      that.$refs.personOut.init(listpersonlist,"",this.AS0119)
                  })
              },
              collect() {
                  var that = this
                  let dataList = this.personList.length || this.multipleSelection.length
                  if (dataList == 0) {
                      that.$message({
                          message: '请选择人员',
                          type: 'warning'
                      })
                      return
                  }
                  let listpersonlist=[...this.personList,...this.multipleSelection]
                  const params = {
                      parentId: listpersonlist,
                      userId: store.getters.user_id.toString()
                  }
                  collectData(params).then(function (result) {
                      if (result.result) {
                          that.$message({
                              message: '收藏成功',
                              type: 'success'
                          })
                      } else {
                          this.$message.error(result.message)
                      }
                  })
              },
              query() {
                this.A0101 = null;
                this.A0184 = null;
                this.queryParams = []
                var han = /^[\u4e00-\u9fa5]+$/;
                var cardId=/\d/g
                var vals=this.searchName.trim();//获取输入input中的val
                if(han.test(vals)){//test()方法表示是否匹配，返回值为true 成功，false 匹配失败
                  this.A0101 = this.searchName.trim();
                  this.currentPage = 1
                }else{
                  if(cardId.test(vals)){
                    this.A0184 = this.searchName.trim()
                    this.currentPage = 1
                  }else {
                    this.A0101 = this.searchName.trim();
                    this.currentPage = 1
                  }
                }
                  this.initData()
              },
              updatePersonList() {
                  this.showUpdatePerson = true
                  if (this.personList.length == 0) {
                      this.$nextTick(() => {
                          // 按照机构获取当前机构全部人员
                          if (this.curOrgId != undefined) {
                              var isContainStr = '1'
                              if (!this.isContain) {
                                  isContainStr = '2'
                              }
                              const personJsons = {
                                  'userId': store.getters.user_id.toString(),
                                  'orgId': this.curOrgId,
                                  'batch': '1',
                                  'isContain': isContainStr,
                                  'AS0119': '3',
                                  'selectHis':this.selectHis
                              }
                              personCHoose('/datacollect/person/querybyid', personJsons).then(data => {
                                  if (data.result) {
                                      if (data.resultdata) {
                                          if (data.result) {
                                              const params = {
                                                  'parentId': data.resultdata.list,
                                                  'type': '1'
                                              }
                                              this.$refs.updatePersons.initAdd(params)
                                          } else {
                                              this.$message.error(item.message)
                                          }
                                      }
                                  } else {
                                      this.$message.error(data.message)
                                  }
                              })
  
                          } else {
                              this.$message({
                                  type: 'warning',
                                  message: '请选择机构！'
                              })
                              return;
                          }
                      })
                  } else {
                      this.$nextTick(() => {
                          const params = {
                              'parentId': this.personList,
                              'type': '1'
                          }
                          this.$refs.updatePersons.initAdd(params)
                      })
                  }
                  // const params = {
                  //     'parentId': this.personList
                  // }
                  // this.showUpdatePerson = true
                  // this.$nextTick(() => {
                  //     this.$refs.updatePersons.initAdd(params)
                  // })
                  /*    this.showUpdatePerson = true
                  if (this.personList == '') {
                    this.$nextTick(() => {
                      this.$refs.updatePersons.initAdd(this.articlesData)
                    })
                  } else {
                    this.$nextTick(() => {
                      this.$refs.updatePersons.initAdd(this.personList)
                    })
                  }*/
  
                  /*    var isContainStr = '1'
                  if(!this.isContain) isContainStr='2'
                  const params = {
                    'parentId': this.personList,
                    'userId': store.getters.user_id.toString(),
                    'orgId': this.curOrgId,
                    'isContain': isContainStr,
                    'AS0119': this.AS0119,
                    'radioC': this.radioC,
                    'A0101': this.A0101,
                    'A0184': this.A0184,
                    'datas': this.articlesData
                  }
                  var that = this
                  that.showUpdatePerson = true
                  this.$nextTick(() => {
                    that.$refs.updatePersons.initAdd(params)
                  })*/
              },
              getParent(id, modules) {
                  const parentMenu = []
                  // console.log(modules)
                  modules.forEach((item) => {
                      if (item.parentId === id) {
                          const b0194 = item.b0194
                          let treeIcon = ''
                          if (b0194 == '3') {
                              treeIcon = 'customRoot-icon'
                          } else if (b0194 == '2') {
                              treeIcon = 'customChildren-icon'
                          } else if (b0194 == '1') {
                              treeIcon = 'customParent-icon'
                          }
  
                          const node = {
                              label: item.name,
                              id: item.id,
                              children: [],
                              parentId: item.parentId,
                              type: b0194,
                              icon: treeIcon
  
                          }
                          parentMenu.push(node)
                          this.getChildMenu(node, modules)
                      }
                  })
                  return parentMenu
              },
              getChildMenu(node, modules) {
                  const itemMenu = this.getParent(node.id, modules)
                  node.children = itemMenu
                  if (itemMenu.length > 0) {
                      itemMenu.forEach((node) => {
                          this.getChildMenu(node, modules)
                      })
                  }
              },
              checkIDCard(idcode) {
                  // 加权因子
                  var weight_factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]
                  // 校验码
                  var check_code = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2']
                  var code = idcode + ''
                  var last = idcode[17]// 最后一位
                  var seventeen = code.substring(0, 17)
                  // ISO 7064:1983.MOD 11-2
                  // 判断最后一位校验码是否正确
                  var arr = seventeen.split('')
                  var len = arr.length
                  var num = 0
                  for (var i = 0; i < len; i++) {
                      num = num + arr[i] * weight_factor[i]
                  }
                  // 获取余数
                  var resisue = num % 11
                  var last_no = check_code[resisue]
                  // 格式的正则
                  // 正则思路
                  /*
                    第一位不可能是0
                    第二位到第六位可以是0-9
                    第七位到第十位是年份，所以七八位为19或者20
                    十一位和十二位是月份，这两位是01-12之间的数值
                    十三位和十四位是日期，是从01-31之间的数值
                    十五，十六，十七都是数字0-9
                    十八位可能是数字0-9，也可能是X
                    */
                  var idcard_patter = /^[1-9][0-9]{5}([1][9][0-9]{2}|[2][0][0|1][0-9])([0][1-9]|[1][0|1|2])([0][1-9]|[1|2][0-9]|[3][0|1])[0-9]{3}([0-9]|[X])$/
                  // 判断格式是否正确
                  var format = idcard_patter.test(idcode)
                  // 返回验证结果，校验码和格式同时正确才算是合法的身份证号码
                  return !!(last === last_no && format)
              },
              handleSizeChange ({ currentPage, pageSize }) {
                  this.currentPage = currentPage
                  this.perPage = pageSize
                  this.initData()
              },
  
  
              initData() {
                  var params
                  console.info(this.queryParams, "______________this.queryParams")
                  if (this.queryParams.length != 0) {
                      this.queryParams.page = this.currentPage
                      this.queryParams.rows = this.perPage
                      params = this.queryParams
                  } else {
                      var isContainStr = '1'
                      if (!this.isContain) {
                          isContainStr = '2'
                      }
                      params = {
                          'userId': store.getters.user_id.toString(),
                          'orgId': this.curOrgId,
                          'page': this.currentPage,
                          'rows': this.perPage,
                          'isContain': isContainStr,
                          // 'AS0119': '3',
                          'radioC': this.radioC,
                          'A0101': this.A0101,
                          'A0184': this.A0184,
                          AS0181:this.selectHis
                          // 'selectHis':this.selectHis
                          /*'AS0101': this.AS0101,   // 女干部
                      'AS0103': this.AS0103,   //少数名族干部
                      'AS0104': this.AS0104   // 党外干部*/
                      }
                  }
                  this.personChoose(params)
              },
              async initItemZwlb(data) {
                  alert(data)
                  // console.log(data,6666666)
                  // this.person.AG0136 = data.ag0201
                  // this.person.AG0136A = data.ag0201a
              },
              // 双击行数据
              dbSelected(row) {
                 let trow = row.row || row
                  const params = {
                      'a0000': trow.a0000
                  }
                  var that = this
                  const a36s = []
                  that.showRMB = true
                  getA36ByA0000(params).then(function (result) {
                      if (result.result) {
                          result.resultdata.forEach((item) => {
                              const a36 = {
                                  a3600: item.a3600,
                                  a3604a: item.a3604a,
                                  a3601: item.a3601,
                                  a3607: item.a3607,
                                  a3627: item.a3627,
                                  a3611: item.a3611,
                                  ag3685: item.ag3685,
                                  ag3686: item.ag3686,
                                  ag3687: item.ag3687,
                                  ag3688: item.ag3688,
                                  ag3689: item.ag3689,
                                  ag3690: item.ag3690,
                                  ag3691: item.ag3691,
                                  ag3692: item.ag3692
  
  
                              }
                              a36s.push(a36)
                          })
                      }
                      that.a36s = a36s
                      that.$nextTick(() => {
                          that.showRMB = true
  
                          that.$refs.rmb.init(trow, that.a36s, that.itemList)
                      })
                  })
              },
  
              showSearchs() {
                  var that = this
                  that.showSearch = true
  
                  that.$nextTick(() => {
                      that.showSearch = true
                      const params = {
                          'AS0119': '3',
                          'selectHis':this.selectHis
                      }
                      that.$refs.search.initAdd(params)
                  })
              },
              onSearchSuccess() {
  
              },
              searchUpdateData(val, value, params) {
                  if (val != null && val != undefined && val != 'undefined') {
                      this.totalItems = 0
                      this.articlesData = []
                      if (value == '1') {// 姓名身份证查询
                          if (val.length > this.perPage) {   // 大于当前页面分页条数   进行分页查询
                              params.page = this.currentPage
                              params.rows = this.perPage
                              this.personChoose(params)
                          } else {
                              this.totalItems = val.length // 设置总记录数
                              this.articlesData = val // 填充列表数据
                          }
                          this.queryParams = params
                      } else {    // 常用查询
                          this.totalItems = val.count // 设置总记录数
                          this.articlesData = val.list // 填充列表数据
                          this.queryParams = params
                      }
                  }
              },
              itemClick(node) {
                  this.selectedNode = node
                  this.showPersons(node)
              },
              personChoose(prams) {
                  this.loading=true;
                  personCHoose('/datacollect/person/querybyid', prams).then(data => {
                      if (data.result) {
                          if (data.resultdata) {
                              this.getJurisdictionItem()
                              console.log(data.resultdata)
                              if (data.result) {
                                  this.totalItems = 0
                                  this.articlesData = []
                                  this.totalItems = data.resultdata.count // 设置总记录数
                                  this.articlesData = data.resultdata.list // 填充列表数据
                                  this.$nextTick(() => {
                                      this.$refs.mytable.recalculate()
                                  })
                              } else {
                                  this.$message.error(item.message)
                              }
  
                          }
                      } else {
                          this.$message.error(data.message)
                      }
                      this.loading=false;
                  })
              },
  
              async showPersons(node) {
                  var orgId = node.id
                  this.curOrgId = orgId
                  var iscontain = '1'
                  if (!this.isContain) iscontain = '2'
                  const personJsons = {
                      'userId': store.getters.user_id.toString(),
                      'orgId': orgId,
                      'page': this.currentPage,
                      'rows': this.perPage,
                      'isContain': iscontain,
                      'AS0119': '3',
                      'selectHis':this.selectHis
  
                  }
                  this.personChoose(personJsons)
              },
              formatDate: function ({row, column}) {
  
                 /* var date = row[column.property];
                  if (date == null) {
                      return "";
                  }*/
                  if(row[column.property]) {
                      let date = new Date(row[column.property]);
                      let Y = date.getFullYear() + '.';
                      let M = date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1)  : date.getMonth() + 1 ;
                      // let D = date.getDate() < 10 ? '0' + date.getDate() + ' ' : date.getDate() + ' ';
                      return Y + M ;
                  }
                 // return moment(date).format("YYYY-MM-DD")
              },
              downloadPersonList() {
                  const params = {
                   //   'personList': this.articlesData,
                      'fileName': '人员管理信息列表.xlsx',
                      'personList': this.$refs.mytable.selection,
                      'userId': JSON.parse(sessionStorage.getItem(`userInfo`)).userId
                  }
                  exportExeclForPersonList(params).then(function(result) {
                  })
              },
              updatePersonType(){
                  var that = this
                  if (this.personList.length == 0) {
                      that.$message({
                          message: '请选择人员',
                          type: 'warning'
                      })
                      return
                  }
                  if (this.personList.length > 1) {
                      that.$message({
                          message: '一次只能变更一位成员',
                          type: 'warning'
                      })
                      return
                  }
                  // 变更
                  that.showUpdatePersonType = true
                  that.$nextTick(() => {
                      that.$refs.updatePersonTypeChange.init(this.personList,"nation")
                  })
              },
              updatePersonInfo(){
                  console.info(this.articlesData,"articlesData")
                  this.showUpdatePersonInfoExexl = true
                  this.$nextTick(() => {
                      this.$refs.updatePersonInfoExexl.initAdd()
                  })
              }
  
          }
      }
  </script>
  
  <style scoped>
    .customRoot-icon {
      width: 20px;
      height: 16px;
      display: inline-block;
      background: url("../../../assets/images/young/customRoot.png");
    }
  
    .customParent-icon {
      width: 20px;
      height: 20px;
      display: inline-block;
      background: url("../../../assets/images/young/customParent.png");
    }
  
    .customChildren-icon {
      width: 20px;
      height: 18px;
      display: inline-block;
      background: url("../../../assets/images/young/customChildren.png");
    }
  
    /* 更改element-UI按钮样式
    .el-button--primary{
      height: 40px;
    }*/
    >>>.vxe-header--column .vxe-cell--title{
      font-size: 12px;
      font-weight: normal;
      color:#909399;
    }
    >>>.vxe-cell--label{
      font-size: 12px;
    }
    >>>.vxe-table--render-default .vxe-cell{
      font-size:12px;
    }
  </style>
  